home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Internet
/
Chip Internet.iso
/
viewer
/
ghost
/
gsview.doc
< prev
next >
Wrap
Text File
|
1993-07-29
|
34KB
|
835 lines
1Overview
?Overview
`Ghostview for Windows` is a graphical interface for MS-Windows `Ghostscript`.
Ghostscript is an interpreter for the PostScript page description language
used by laser printers.
For documents following the Adobe PostScript Document Structuring
Conventions, Ghostview for Windows allows selected pages to be viewed or
printed.
Ghostview for Windows can be used with Windows Ghostscript 2.6 or later.
Ghostview for Windows was inspired by Tim Theisen's X11 Ghostview
program.
The ability to understand `DSC` comments comes from X11 Ghostview.
2Document Structuring Conventions
?Document Structuring Conventions
?DSC
?Encapsulated PostScript
?EPSF
?EPS
Adobe has defined a set of extended comment conventions that provide
additional information about the page structure and resource
requirements of a postscript file.
If a file contains these Document Structuring Convention (DSC) comments,
Ghostview can display pages in random order using `Goto` and display pages
in reverse order using `Prev`. Selected pages can be extracted to
another file or printed.
If a file does not contain DSC comments, Ghostview can only
display the pages in the original order.
DSC conforming files start with the comment line:
%!PS-Adobe-3.0
where the number 3.0 may change and is the DSC version number.
Some programs write postscript files with a control-D as the first
character of the file, followed by the comment line mentioned above.
Ghostview will correctly report that these files are not DSC conforming,
but will still display them with page selection features available.
Complain to the author of the program that produced the postscript file.
To make the file DSC conforming, edit it to remove the control-D character.
DSC conforming files contain lines such as:
%%Pages: 24
%%Page: 1 1
These lines tell Ghostview how many pages a document contains and
where they start. Ghostview uses this information to select
individual pages.
Encapsulated PostScript Files (EPSF) are single page documents
that contain a subset of the `DSC` comments and PostScript commands.
EPS files start with the comment line:
%!PS-Adobe-3.0 EPSF-3.0
EPS files are commonly used for inclusion in other documents and
for this reason require the bounding box comment:
%%BoundingBox: llx lly urx ury
where llx, lly, urx and ury are integers giving the x and y coordinates
of the lower left and upper right corners of a bounding box which encloses
all marks made on the page.
Some EPS files contain a preview of the postscript document.
This preview can be a Windows Metafile, a TIFF file, or an Interchange
preview (EPSI format).
For the Windows Metafile or TIFF file preview, the EPS file under DOS
contains a binary header which specifies the location and lengths of
the preview and postscript language sections of the EPS file.
For the Interchange format, the preview is contained in DSC comments
starting with
%%BeginPreview: width height depth lines
An EPS file with a preview can be created from an EPS file without a
preview using `Add EPS Preview`
2Opening a Document
?File
?Open
?Select File
?Close
The `Open` command on the `File` menu opens a file and displays
the first page.
If the file contains `DSC` comments, pages can be selected using
`Next`, `Prev` and `Goto`.
If the file does not contain `DSC` comments, `Prev` and `Goto` will
not work. Another file should not be selected until a last page of
the file has been displayed.
When a file is open, Ghostview will display the document filename,
the current page (if available) and while the cursor is over
the image, the location of the cursor in default user coordinates
(1/72 inch).
The cursor location is useful for calculating bounding boxes.
The `Select File` command is similar to `Open` but it does not display
the document.
This command is useful for opening a document prior to printing it.
The `Close` command closes the currently open document.
This should be used before the current file is changed by another
program.
If you do not do this and Ghostview detects that the file length or date
have changed, it will close Ghostscript and rescan the document.
See also `Print`.
2Page Selection
?Page Selection
?Next
?Prev
?Redisplay
?Goto
`Next` moves to the next page of a document.
This works even if the document does not contain `DSC` comments.
`Prev` moves to the previous page.
`Redisplay` redisplays the current page.
`Goto` shows a dialog box which allows selection of the next page
number to display. The `Select Page` dialog box shows page labels
since these are likely to be more useful than a sequential page number.
The `Prev`, `Redisplay` and `Goto` commands work only if the
document contains `DSC` comments.
2Document Information
?Info
A brief information area at the top of the window is used by
Ghostview to display the document filename, the current page number
and label (if available) and while the cursor is over the image, the
location of the cursor in default user coordinates (1/72 inch).
The cursor location is useful for calculating bounding boxes.
The `Info` command on the `File `menu shows a dialog box with the
following information about the `DSC` comments in the current document.
`File `is the full pathname to the document.
`Type` is` DSC`,` EPS` or `No DSC comments`.
`EPS` is an Encapsulated PostScript File - a single page document
that contains a subset of the `DSC` comments and PostScript commands.
`EPS `files are commonly used for inclusion in other documents.
`Title` is a text title that can be used when printing banner
pages and for routing or recognising documents.
`Date` is the time the document was created.
`BoundingBox` specifies a box that encloses all the marks painted
on the page. The four integer values are the coordinates of the
lower left and upper right corners of the bounding box in default
user coordinates (1/72 inch).
`Orientation `is either `Portrait `or` Landscape`.
`Default Media` gives the media name followed by the width and
height of that media in default user coordinates (1/72 inch).
`Page Order` is either `Ascending`, `Descending` or `Special`
`Pages` is the total number of pages in the document.
`Page` gives the page label and page number.
`Bitmap `is the size of the display bitmap in pixels which may be
useful if you are copying the displayed image to the clipboard.
2Printing
?Print
?Print To File
?Print File
?Extract
The `Print` command on the `File `menu allows printing of the document
using Ghostscript.
The Ghostscript printer driver and resolution are selected using the
`Select Device` dialog box. Pages are selected using the `Select Pages`
dialog box. The `All`, `Odd` and `Even` buttons provide quick selection
of pages.
The `mswinprn` printer driver uses the windows printer drivers
and should work with any printer with raster capabilities.
Printer resolution cannot be selected from within Ghostview; use
the Control Panel instead. This driver is very slow.
With all other printer drivers, Ghostscript sends the output direct
to the printer, without passing through a Windows printer driver.
If you have trouble printing you may have to `Print To File`
and then `Print File` or use the DOS command `COPY /B FILENAME PRN`.
This list of available devices and resolutions is stored in the
[Devices] section of gsview.ini. The default list of devices
and resolutions is taken from the standard distribution version
of Ghostscript for Windows 2.6 and may not be complete.
To print a document without displaying it, open the document
using `Select File`.
`Print To File` is similar to the `Print` command except that Ghostscript
will write the output to a file instead of sending it to a printer.
If you want to produce a bitmap, some useful drivers are
`bmpmono`, `bmp16`, `bmp16m` and `bmp256`.
`Print File` sends a file to a local port, bypassing the Windows
printer drivers.
This is useful for sending a document to a PostScript printer,
or for sending an output file produced by Ghostscript to a printer.
`Extract` allows a range of pages to be copied from the current
document to a new document. For example, ten pages can be extracted
from the middle of the current document and written to another file,
which will later be sent to a printer.
3Properties
?Properties
Some printer drivers allow extra properties to be specified.
If two sections are added to the gsview.ini file for these printer
drivers, Ghostview will enable the `Properties` button which will
display the `Edit Properties` dialog box.
The following example shows how to add property information
for the cdjcolor driver.
First add a section which gives the current values.
This section, after the first character is removed, gives the options
that will appear in the `Property` list box.
The first character is `s` for string or `d` for number.
[cdjcolor]
dBitsPerPixel=24
dDepletion=1
dShingling=2
dBlackCorrect=4
Next add a section which gives the values to display in the
`Value` list box.
[cdjcolor values]
dBitsPerPixel=1,3,8,16,24
dDepletion=1,2,3
dShingling=0,1,2
dBlackCorrect=0,1,2,3,4,5,6,7,8,9
Ghostview will also add the value `[Not defined]` to the listbox.
When you press the `OK` button in the `Edit Properties` dialog
box, the current settings are written to the gsview.ini file.
When Ghostview prints a file, it will give Ghostscript the contents
of the [cdjcolor] section of gsview.ini as follows:
-dBitsPerPixel=24 -dDepletion=1 -dShingling=2 -dBlackCorrect=3
If the value of a property is `[Not defined]`, that property will
not be sent to Ghostscript.
Some entries for the cdj family of drivers are supplied in the
property.ini file that comes with Ghostview.
3PS to EPS
?PS to EPS
In general, it is not possible to convert a PostScript file to `EPS`.
However, many single page PostScript files can be converted to `EPS`
by changing the first line of the file to
%!PS-Adobe-3.0 EPSF-3.0
and then adding or fixing up the `%%BoundingBox` comment.
To convert a PostScript file to `EPS`, the original file `must` be
a `single page` document. If the document contains `DSC` comments
and is multi page, extract the desired page with `File` | `Extract`.
If the document does not contain `DSC` comments, you will need to
edit the file by hand to extract the desired page.
`EPS` documents `must not` use any of the following operators:
banddevice clear cleardictstack copypage
erasepage exitserver framedevice grestoreall
initclip initgraphics initmatrix quit
renderbands setglobal setpagedevice setpageparams
setshared startjob letter note
legal a3 a4 a5
The following operators should be used with care:
nulldevice setgstate sethalftone setmatrix
setscreen settransfer setcolortransfer
It is `your` responsibility to make sure that the above requirements
are met.
To test if a document contains any of the above operators, select
`Options` | `EPS Warn` and then `Open` the desired document.
After the page has been displayed, look in the Ghostscript text window.
If any of the above operators have been used you should see lines like:
Warning: EPS files must not use ...
If you find these warnings then do `not` use `PS to EPS`.
Remember to turn off `EPS Warn` afterwards.
A document must be displayed before `PS to EPS` is used.
The document must contain a `showpage`.
This is required so that the bounding box can be measured.
For documents without `DSC` comments, `PS to EPS` allows a bounding
box to be specified, then writes out an `EPS` file consisting of
an `EPS` wrapper around the original document.
For documents with `DSC` comments, `PS to EPS` will change the
first line of the file to
%!PS-Adobe-3.0 EPSF-3.0
then allows the `%%BoundingBox` comment to be changed or added.
For `EPS` documents, `PS to EPS` allows the `%%BoundingBox` comment to
be changed.
See also `Add EPS Preview`, `Extract`, `EPS Warn`.
2Clipboard
?Clipboard
?Edit
?Copy
?Paste To
?Convert Bitmap
?Bitmap
?Add EPS Preview
?Extract EPS
The Ghostview window can be copied to the Clipboard as a bitmap
by selecting `Copy` from the `Edit` menu.
The bitmap may be a Device Independent Bitmap or it may be a Device
Dependent Bitmap, depending on how Ghostscript was compiled.
The default for Ghostscript 2.6 is a Device Independent Bitmap
(BMP format).
An alternative way to get a bitmap output from Ghostscript is
to use one of the BMP drivers. See `Print`.
`Paste To` copies a Device Independent Bitmap from the Clipboard
(if available) to a BMP file.
`Convert Bitmap` converts between a Device Independent Bitmap and
a Device Dependent Bitmap.
If the clipboard contains a Device Independent Bitmap (BMP format),
this is converted to a Device Dependent Bitmap and added to the clipboard.
If the clipboard does not contain a colour palette, one is created
from the Device Independent Bitmap and added to the clipboard.
This option is present because some applications (notably Windows
Paintbrush) won't recognise a Device Independent Bitmap in the clipboard.
`Add EPS Preview` takes a bitmap from the clipboard and uses it to add
a preview to an EPS file.
`Add EPS Preview` can create a DOS EPS file with a Windows Metafile or
TIFF preview, or an EPSI file with an Interchange preview.
To use the `Add EPS Preview` command the following steps must be followed.
1. Make sure the document has a correct bounding box.
A bounding box can be added or changed using `File` | `PS to EPS`.
2. Select `Orientation` | `Portrait`.
3. Select `Options` | `EPS Clip`.
This will cause Ghostscript to use a display window the size of the
bounding box instead of the page size.
4. Select `Media` | `Resolution` and set a suitable resolution
for the preview. If the resolution is too high the bitmap may not
fit in the clipboard, or will make the EPS file excessively large.
5. `Open` an EPS file that does not contain a preview.
6. Select `Edit` | `Copy`. This tells Ghostscript to copy the
display bitmap to the Clipboard. This allows Ghostview to access
the bitmap in the next step.
7. Select `Edit` | `Add EPS Preview`, then the preview format,
then the new EPS filename. Ghostview will write a new file containing
the original PostScript EPS file and a preview created from the bitmap
in the clipboard.
The available preview formats are `Interchange`, `TIFF 4`, `TIFF 5`
and `Windows Metafile`.
If adding an Interchange preview, the document must have an `%%EndComments`
line, otherwise Ghostview may put the preview in the wrong place.
A TIFF 5 preview is a Class B image with no compression as described
in Appendix G of the TIFF 5.0 memorandum. A TIFF 4 preview is almost
identical to the TIFF 5 preview, but avoids using tags which are not
described in the TIFF 4 specifiation.
WordPerfect 5.1 requires a TIFF 4 preview.
8. Reset `Orientation` | `Portrait`, `Options` | `EPS Clip`
and `Media` | `Resolution` to their previous values.
To extract the PostScript or Preview section from a DOS EPS
file, use `File` | `Select File` followed by `Edit` | `Extract EPS`
then `PostScript` or `Preview`.
See also `PS to EPS`.
2Options
?Options
The `Options` menu has the following selections
3Ghostscript Command
?Ghostscript Command
The `Ghostscript Command` option allows selection of the command
to use when executing Ghostscript. The default is `gswin`.
If Ghostscript is not in the Ghostview directory, or not on the
PATH, use this option to set the full pathname to Ghostscript.
If you wish to specify that Ghostscript should look for its
initialisation files in a different place, add a -I option to
the command as in the following example:
c:\gs\gswin -Ic:\gs;d:\psfonts
Try to keep the command length short, otherwise Ghostview will
have trouble printing files with Ghostscript.
Only the Ghostscript EXE and include path may be specified -
other items will confuse Ghostview.
3Sounds
?Sounds
The `Sounds` option assigns sounds to various events.
For each event the sound can be set to `None`, a `Speaker Beep` or
a `Wave` file.
You must have a sound driver loaded before using Wave files.
Wave file sounds are not available under Windows 3.0.
The events are:
`Output Page`: the PostScript showpage operator was executed.
`No Page`: an invalid page was selected.
For example, pressing `Prev` while on the first page of a document
with `DSC` comments.
`No Number`: a command required page numbering and the document did
not have page numbering.
For example, pressing `Goto` when viewing a document without
`DSC` comments.
`Not Open`: a command required a document to be open and this was
not the case.
For example, pressing `Goto` when no document is open.
`Error`: many types of errors.
`Timeout`: no response from Ghostscript within a timeout period.
For example, display snowflak.ps on a PC with a 286-12 CPU.
`Start`: Ghostview opened.
`Exit`: Ghostview closed.
The defaults are for `No Page` and `Error` to be a `Speaker Beep`
and all other events to be `None`.
3Save Settings
?Save Settings
?Settings
?INI file
?Save Settings on Exit
The `Save Settings` option saves the Ghostview window position,
window size, last used printer, last directory, `Save Last Directory`,
`User Defined`, `Ghostscript Command`, `Button Bar`, `Quick Open`,
`Auto Redisplay`, `EPS Clip`, `EPS Warn`, `Sounds`, `Orientation`,
`Media` and `Resolution` options to the file gsview.ini in the
windows directory.
Ghostview reads gsview.ini during startup.
When the `Save Settings on Exit` option is checked, Ghostview will
automatically save the above settings when you quit Ghostview.
3Safer
?Safer
When the `Safer` option is `checked`, Ghostview will give Ghostscript
the `-dSAFER` flag, which disables the deletefile and renamefile operators,
and the ability to open files in any mode other than read-only.
This is the default.
When the `Safer` option is `unchecked` Ghostscript can change
files.
3Save Last Directory
?Save Last Directory
When the `Save Last Directory` option is `checked`, Ghostview will
save the current directory when you quit Ghostview. When Ghostview
is started next, this will be made the current directory.
This is the default.
When `Save Last Directory` option is `unchecked`, the current
directory when Ghostview is started will be the directory where
Ghostview is located, or the working directory specified by
the Program Manager.
3Button Bar
?Button Bar
When the `Button Bar` option is `checked`, Ghostview will display
a Button Bar down the left side of the window. This is the default.
The Button Bar contains the following items:
`File` | `Open`
`File` | `Print`
`File` | `Info`
`Help` | `Contents`
`File` | `Goto`
`File` | `Next`
`File` | `Prev`
`Go forward 5 pages`
`Go back 5 pages`
When the `Button Bar` option is `unchecked`, Ghostview will not
display the Button Bar.
3Quick Open
?Quick Open
When the `Quick Open` option is `checked`, Ghostview will not reload
Ghostscript before every document, making opening of documents quicker.
Ghostview tries to preserve the Ghostscript state between documents,
but a document may still leave the Ghostscript interpreter in an unusual
state or cause an error. If an error occurs, Ghostscript will close.
Error messages are displayed in the Ghostscript window.
Select `Redisplay` to reopen the document.
If `Quick Open` is `unchecked`, Ghostview will close Ghostscript and
restart it before each new document or whenever the page orientation,
resolution or size is changed.
3Auto Redisplay
?Auto Redisplay
When the `Auto Redisplay` option is `checked`, Ghostview will
redisplay `DSC` documents when the `Orientation`, `Resolution`
or `Media` are changed.
If `Auto Redisplay` is `unchecked`, the `File` | `Redisplay` command
must be used to redisplay a document after changing the
`Orientation`, `Resolution` or `Media`. This is the default.
3EPS Clip
?EPS Clip
When the `EPS Clip` option is `checked`, Ghostview will clip the
display bitmap to the bounding box of an EPS file instead of using the
page size specified on the `Media` menu. This is useful when
adding a bitmap preview to an EPS file.
If `EPS Clip` is `unchecked`, Ghostview will use the page size
specified on the `Media` menu for EPS files. This is the default.
See also `Clipboard` | `Add EPS Preview`
3EPS Warn
?EPS Warn
When the `EPS Warn` option is `checked`, Ghostview will write a
prolog to Ghostscript when each file is opened. This prolog will
produce warning messages in the Ghostscript text window if any
PostScript operators that should not be used in `EPS` files
are used. An example warning message is:
Warning: EPS files must not use /initgraphics
`EPS Warn` is not infallible. It is possible to access restricted
operators without `EPS Warn` producing a warning.
The default for `EPS Warn` is `unchecked`.
See also `PS to EPS`.
2Page Orientation
?Orientation
?Portrait
?Landscape
?Upside-down
?Seascape
?Swap Landscape
The `Portrait`, `Landscape`, `Upside-down` and `Seascape`
(reverse Landscape) commands on the `Orientation `Menu select
the page orientation used by the display.
`Landscape` implies a clockwise rotation of the paper by 90 degrees.
`Seascape` implies an anti-clockwise rotation of the paper by 90 degrees.
These orientation options only affect the display and do not affect
the print commands.
If a `DSC` page orientation comment is found, the orientation will be
selected automatically.
When the `Swap Landscape` option is `checked`, Ghostview swaps the
meaning of Landscape and Seascape.
Most of the Landscape documents that I have encountered require a 90
clockwise rotation of the paper to view.
However, there is no standard and some documents need to be rotated
the other way.
The `Swap Landscape` button allows Ghostview to automatically rotate the
document the right way in response to the `%%Orientation` comment in the
PostScript file.
2Page Size and Display Resolution
?Resolution
?Media
?Page Size
?User Defined
The `Resolution` command on the `Media` menu selects the display
resolution in dots per inch.
The default for a VGA display is 96 dots per inch.
The `Media` menu also allows selection of page size.
Available page sizes are:
Letter 8.5 x 11 inch
Tabloid 11 x 17 inch
Ledger 17 x 11 inch
Legal 8.5 x 14 inch
Statement 5.5 x 8.5 inch
Executive 7.5 x 10 inch
A3 297 x 420 mm
A4 210 x 297 mm
A5 148 x 210 mm
B4 257 x 364 mm
B5 182 x 257 mm
Folio 8.5 x 13 inch
Quarto 8.5 x 10.8 inch
10x14 10 x 14 inch
A user defined size can be specified in PostScript points (1/72 inch)
with the `User Defined` command. A size of 480x360 points at 96 dpi
will give an image size of 640x480 pixels.
If a `DSC` media comment is found, the page type will be selected
automatically. If the media specification is not one of the above
page types, the `User Defined` size will be set.
2Running Ghostview from the File Manager
?Registration Info Editor
?File Manager
To run Ghostview when a PostScript file is double clicked in the
File Manager, the following sequence must be followed to teach
File Manager about PostScript files.
From the `Program Manager`, run the Registration Info Editor using
`File `| `Run...` then type `regedit`.
From the `Registration Info Editor` select `Edit `| `Add File Type...`
then enter the following fields:
Identifier = psfile
Filetype = PostScript
Action = Open
Command = gsview %1
Uses DDE = unchecked
Action = Print
Command = gsview /p %1
Uses DDE = unchecked
Then press `OK`.
From the `File Manager`, select `File `| `Associate` then
enter the following fields:
Files with Extension = ps
Associate With = PostScript (gsview)
Then press `OK`.
Put gsview.exe and gsview.hlp in a directory on your PATH.
That's it! Now when you double click on a PostScript file,
the `File Manager` will run Ghostview. When you drop a PostScript
file on the `Print Manager`, Ghostview will print the file.
2Command line options
?Command line options
Usage:
gsview [/D] filename
gsview [/D] /F filename
gsview [/D] /P filename
gsview [/D] /S[port] filename
To start Ghostview and display filename.ps use:
gsview filename.ps
To start Ghostview and print filename.ps using Ghostscript
(`File` | `Print`) use:
gsview /P filename.ps
To start Ghostview and print filename.ps to a file using Ghostscript
(`File` | `Print To File`) use:
gsview /F filename.ps
To start Ghostview and spool filename.ps for printing directly to
a printer (`File` | `Print File`) use:
gsview /S filename.ps
To start Ghostview and spool filename.ps for printing directly to
printer port LPT3: use:
gsview /SLPT3: filename.ps
To start Ghostview in debug mode use:
gsview /D
In debug mode Ghostview will `not` remove its temporary files.
This is to allow inspection of these files after Ghostview has finished.
Ghostview for Windows ignores the case of option:
/p is the same as /P.
2Copyright
?Copyright
The `About` menu item shows the Ghostview copyright message
and Ghostview version number.
GSVIEW.EXE - A Ghostscript graphical interface
Copyright (C) 1993 Russell Lang
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Author: Russell Lang
Internet: rjl@monu1.cc.monash.edu.au
ps.c module Copyright (C) 1992 Tim Theisen (tim@cs.wisc.edu).
2Common Problems
?Problems
`Problem:` Ghostview can't run gswin.
Ghostview requires Ghostscript for Windows (gswin.exe).
If you don't have Ghostscript for Windows, it is hardly suprising
that Ghostview can't run it.
From the Ghostview menu select `Options` | `Ghostscript Command`
and enter the correct executable path and include path for Ghostscript.
For example:
c:\gs\gswin.exe -Ic:\gs
The default Ghostscript Command is `gswin`. This will work if
Ghostscript is in the same directory as Ghostview, or if the
Ghostscript directory is on the PATH.
Make sure you don't already have Windows Ghostscript running.
Only one copy of Windows Ghostscript can be running at a time.
Only one copy of Ghostview can be running at a time.
`Problem:` Ghostscript starts and then immediately exits with error code 1.
Read the error message in the Ghostscript window before pressing OK
in the message box.
Ghostscript probably couldn't find its initialisation files.
Set the environment variable GS_LIB to the directory containing
the Ghostscript initialisation files, or add -Idirectory to the command
in `Options` | `Ghostscript Command`.
Read the file use.doc that comes with Ghostscript.
`Problem:` Message Box says `Incompatible Windows Ghostscript`
You probably have an earlier version of Ghostscript.
Make sure you have Ghostscript version 2.6 or later.
`Problem:` Ghostview says 'wait' and shows an hourglass cursor.
When the cursor is moved off the Ghostview window it changes to a
normal arrow.
The above state is normal while Ghostview is waiting for Ghostscript
to do something. It may be that the document is very complex and
Ghostscript is just taking a long time. In this state it is safe to
resize or scroll the window, but do not select any menu commands.
If this is not the case then Ghostview probably got no response
from Ghostscript.
Open the Ghostscript text window and look at any error messages.
Close Ghostscript using the Ghostscript system menu.
If Ghostview is still waiting, press the Ghostview Open button
(even though the cursor is still an hourglass).
Press the 'Yes' button on the 'gsview is busy' message box.
Ghostview should then revert to the non-waiting mode.
`Problem:` Ghostview says that a multipage postscript file produced by
Word for Windows contains 0 pages and will only show the first page.
This is because the document does not have correct DSC comments.
From the Control Panel, select `Printers`, `Options...`, `Advanced` and
then check the `Conform to Adobe Document Structuring Convention`.
The DSC comment `%%Pages: 0` means that the document does not produce
any pages. That is, the PostScript `showpage` operator is not used.
If you find a PostScript document that has multiple pages and contains
the `%%Pages: 0` comment, change the first line from `%!-PS-Adobe-` to `%!`.
Ghostview will then ignore the DSC comments and allow you to view all
pages, but only in the original order. Complain to the author of the
program that produced that PostScript file.
`Problem:` PostScript files produced by Windows start with a Control-D.
Since this occurs even when the PostScript printer
`Conform to Document Structuring Convention`
checkbox is checked, this must be considered a
bug in the Windows PostScript printer driver.
The solution is documented in the Windows PRINTERS.WRI file.
Edit the win.ini file and search for the postscript printer section.
There may be more than one. In each of these sections add
`CTRLD=0` as shown below.
[Apple LaserWriter II NT,FILE]
CTRLD=0
`Problem:` Ghostscript always outputs to a printer instead of the
Ghostview window.
You must not use the GS_DEVICE environment variable.
2Internals
?Internals
The preferred method for driving Ghostscript would be to start it
as a child process and then to send it postscript code through a pipe.
Windows 3.1 supports neither child processes nor pipes.
Ghostview interacts with Ghostscript by sending messages between
the Ghostview and Ghostscript windows.
Ghostview creates an imitation pipe to Ghostscript by writing
into a shareable global memory block and then passing the handle
to Ghostscript.
Ghostview starts Ghostscript for displaying using
gswin -rXDPIxYDPI -gWIDTHxHEIGHT -sGSVIEW=xxxx -
where xxxx is the handle to the Ghostview window.
Ghostscript then tells Ghostview the handle to the text window by sending
a message WM_USER with wParam HWND_TEXT=0 to the Ghostview window.
Instead of creating another window for the image, Ghostscript
creates a child window of the Ghostview window for displaying
the bitmap. Ghostscript tells Ghostview the handle to this child
image window by sending a message WM_USER with wParam
HWND_IMGCHILD=1.
Ghostscript also sends WM_USER messages to Ghostview with wParam
GSWIN_CLOSE=2 when it is exiting,
SYNC_OUTPUT=3 when the image needs to be redrawn (win_sync_output),
OUTPUT_PAGE=4 when a page is to be output (win_output_page),
SCROLL_POSITION=5 when the window is scrolled and
PIPE_DATA=6 for passing the handle to a global memory block (in
lParam) for the imitation pipe.
When Ghostscript sends the OUTPUT_PAGE command it waits until it
receives a NEXT_PAGE command from Ghostview.
Ghostview sends WM_USER messages to the Ghostscript Image window with
wParam NEXT_PAGE=10 when it is time to move to the next page and
COPY_CLIPBOARD=11 when the bitmap should be copied to the clipboard.
Ghostview sends WM_USER messages to the Ghostscript Text window with
wParam PIPE_REQUEST=12 when it wants more pipe data.
Ghostview uses temporary files of the name gsviewXX.XXX in the
directory given by the TEMP environment variable.
Keep TEMP short to avoid the gswin command line exceeding 128 characters.
Ghostview starts Ghostscript for printing using
gswin -sGSVIEW=xxxx @optfile filename.ps quit.ps
optfile contains
-dNOPAUSE
-sDEVICE=devname
-rXDPIxYDPI
-gWIDTHxHEIGHT
-sOutputFile=filename
The ability to select individual pages for an Adobe Document
Structuring Conventions conforming document is due to the inclusion of
the ps.c module from X11 Ghostview by Tim Theisen (ghostview@cs.wisc.edu).
Don't send mail to Tim about Ghostview for Windows, unless it is about a
bug in the ps.c module.